import { Navigate } from "react-router-dom"

import Main from "../views/index";
import Film from "../views/home/film";
import Cinema from "../views/home/cinema";
import Center from "../views/home/center";
import Ad from "../views/home/ad";
import Filmdetail from "../views/cinema/filmdetail"
import Cinemadetail from "../views/cinema/cinemadetail"
import Buyticket from "../views/cinema/buyticket"
import Search from "../views/search/index"
import Login from "../views/login/index"
import City from "../views/city/index"

export const router = [
    {
        path: "/",
        element: <Main />,
        children: [
            // <Route path="/" element={<Navigate to="/films" replace />} />
            {
                // 默认重定向到films
                path: "/",
                element: <Navigate to="/films" replace />
            },
            {
                // 电影
                path: "films",
                element: <Film />
            },
            {
                // 影院
                path: "cinemas",
                element: <Cinema />
            },
            {
                // 资讯
                path: "ad",
                element: <Ad />
            },
            {
                // 我的
                path: "center",
                element: <Center />
            }
        ]
    },
    {
        // 电影详情
        path: "film/:id",
        element: <Filmdetail />

    },
    {
        // 影院详情
        path: "cinema/:id/film",
        element: <Cinemadetail />
    },
    {
        // 选座购票
        path: "/film/:id/cinemas",
        element: <Buyticket />
    },
    {
        // 影院搜素
        path: "/cinemas/search",
        element: <Search />
    },
    {
        // 登录
        path: "/login",
        element: <Login />
    },
    {
        // 切换城市
        path: "/city",
        element: <City />
    },
    {
        path: "*",
        element: <div>404,找不到网页</div>
    },
]